<!--
 * @Author:shuaishuai
-->
<template>
  <div class="left-content-box">
    <div class="pageTitle">治金行业煤炭消费量</div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">建材行业煤炭消费量</div>
        <div ref="pieChart" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem" style="margin: 0 70px">
      <div class="titleBox">
        <div class="title">建材行业煤炭消费量</div>
        <div ref="pieChart2" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">煤化行业煤炭消费量</div>
        <div ref="pieChart3" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">炼焦行业煤炭消费量</div>
        <div ref="pieChart4" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem" style="margin: 0 70px">
      <div class="titleBox">
        <div class="title">供热行业煤炭消费量</div>
        <div ref="pieChart5" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
    <div class="contentItem">
      <div class="titleBox">
        <div class="title">其他行业煤炭消费量</div>
        <div ref="pieChart6" style="width: 1370px; height: 790px"></div>
      </div>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
import { defineComponent } from 'vue'
export default defineComponent({
  data() {
    return {}
  },
  created() {},
  mounted() {
    this.getChart()
    this.getChartTwo()
    this.getChartThree()
    this.getChartFour()
    this.getChartFive()
    this.getChartSix()
  },
  methods: {
    getChart() {
      let chart = echarts.init(this.$refs.pieChart)
      let bar01color = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(190, 255, 110, 1)'
        },
        {
          offset: 1,
          color: 'rgba(20, 156, 219, 0)'
        }
      ])
      var option = {
        tooltip: {
          top: '10%',
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },
        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        xAxis: [
          {
            type: 'category',
            boundaryGap: true, //坐标轴两边留白
            data: ['2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
            axisLabel: {
              //坐标轴刻度标签的相关设置。
              interval: 0, //设置为 1，表示『隔一个标签显示一个标签』
              margin: 15,
              textStyle: {
                color: '#fff',
                fontStyle: 'normal',
                fontFamily: '微软雅黑',
                fontSize: 40
              }
            },
            axisTick: {
              //坐标轴刻度相关设置。
              show: false
            },
            axisLine: {
              //坐标轴轴线相关设置
              lineStyle: {
                color: '#fff',
                opacity: 0.2
              }
            },
            splitLine: {
              show: true,
              // interval: information.area.length,
              lineStyle: {
                color: 'rgba(180, 228, 255, 0.1)',
                width: 2
              }
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameGap: 25,
            splitLine: {
              show: false
            },
            nameTextStyle: {
              color: 'white',
              fontSize: 40,
              padding: [0, 0, 10, 20]
            },
            axisLabel: {
              fontSize: 40,
              color: 'white'
            },
            axisLine: {
              lineStyle: {
                // 坐标线
                type: 'solid',
                color: 'rgba(0, 0, 0, 0.5)', // 轴的颜 色
                width: '1' // 坐标线宽度
              }
            }
          },
          {
            name: '%',
            // max: maxR,
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, 20]
            },

            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            },
            splitLine: {
              show: false,
              lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)'
              }
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            }
          }
        ],
        series: [
          {
            name: '消费量',
            type: 'bar',
            data: [2, 1, 2, 3, 1, 2, 3, 5],
            barWidth: 33,
            barGap: 1, //柱间距离

            itemStyle: {
              //图形样式
              normal: {
                borderColor: bar01color,
                borderWidth: 3,
                color: function (params) {
                  return params.name == '2024' ? 'rgba(0, 0, 0, 0)' : bar01color // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                },
                barBorderRadius: 11
              }
            }
          },
          {
            name: '增速',
            type: 'line',
            // symbolSize: 1,
            yAxisIndex: 1,
            color: 'rgba(255, 195, 0, 1)',
            itemStyle: {
              normal: {
                color: 'rgba(255, 195, 0, 1)',
                barBorderRadius: 0,
                label: {
                  show: false
                }
              }
            },
            lineStyle: {
              width: 5
            },
            data: [66, 43, 5, 44, 53, 24, 54, 44]
          }
        ]
      }
      chart.setOption(option, true)
    },
    getChartTwo() {
      let chart = echarts.init(this.$refs.pieChart2)
      let colorData = new echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(41, 215, 227, 1)'
        },
        {
          offset: 1,
          color: 'rgba(0, 85, 255, 0)'
        }
      ])
      let option = {
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },
        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },
        xAxis: {
          data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
          triggerEvent: true,
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          },
          axisLabel: {
            show: true,
            rotate: 0,
            interval: 0,
            textStyle: {
              padding: [14, 0, 0, 0],
              fontSize: 40,
              color: '#fff'
            }
          },
          splitLine: {
            show: true,
            // interval: information.area.length,
            lineStyle: {
              color: 'rgba(180, 228, 255, 0.1)',
              width: 2
            }
          }
        },
        yAxis: [
          {
            type: 'value',
            name: '万亿千瓦时',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '发电量',
            // barMinHeight: 10,
            type: 'pictorialBar',
            barCategoryGap: '30%',
            symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
            itemStyle: {
              normal: {
                borderColor: colorData,
                borderWidth: 5,
                //渐变色
                // color: colorData
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : colorData // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            data: [70, 60, 80, 20, 30, 44, 53, 67, 32, 23]
            // z: 10,
          },
          {
            name: '增速',
            type: 'line',
            yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
            // smooth: true, //平滑曲线显示
            showAllSymbol: true, //显示所有图形。
            symbol: 'circle', //标记的图形为实心圆
            color: 'rgba(255, 195, 0, 1)',
            // symbolSize: 20, //标记的大小
            // itemStyle: {
            //     //折线拐点标志的样式
            //     color: "rgba(255, 195, 0, 1)",
            //     borderColor: "#fff",
            //     borderWidth: 5
            // },
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [42, 38, 48, 35, 29, 28, 3, 5, 99, 122]
          }
          // {
          //   name: "hill",
          //   type: "bar",
          //   barWidth: "20%",
          //   symbol: "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",
          //   itemStyle: {
          //     normal: {
          //       color: "rgba(11,47,68,.2)",
          //     },
          //   },
          //   data: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
          //   z: 9,
          // },
        ]
      }

      chart.setOption(option, true)
    },
    getChartThree() {
      let barColor = new echarts.graphic.LinearGradient(0, 0, 1, 0, [
        {
          offset: 0,
          color: 'rgba(0, 95, 255, 1)'
        },
        {
          offset: 0.5,
          color: 'rgba(123, 173, 255, 1)'
        },
        {
          offset: 1,
          color: 'rgba(0, 95, 255, 1)'
        }
      ])
      const chartsBar = echarts.init(this.$refs.pieChart3)
      var data = [
          { name: '圆柱体1', value: 20 },
          { name: '圆柱体2', value: 13 },
          { name: '圆柱体3', value: 8 }
        ],
        dataList = []
      data.forEach((item, index) => {
        dataList.push(item.value)
      })

      let option = {
        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        xAxis: {
          data: ['2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
          axisLabel: {
            fontSize: 40,
            color: 'white',
            show: true,
            interval: 0, // 使x轴文字显示全
            margin: 20
          },

          splitLine: {
            show: true,
            // interval: information.area.length,
            lineStyle: {
              color: 'rgba(180, 228, 255, 0.1)',
              width: 2
            }
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: '#fff',
              width: 0,
              type: 'solid'
            }
          }
        },
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },
        yAxis: [
          {
            type: 'value',
            name: '亿千瓦时',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '发电量',
            type: 'pictorialBar',
            symbolSize: [68, 10],
            symbolOffset: [0, -5],
            symbolPosition: 'end',
            z: 12,
            barWidth: 68,
            tooltip: {
              show: false
            },
            label: {
              normal: {
                show: false
              }
            },
            itemStyle: {
              color: 'rgba(169, 201, 255, 1)'
            },
            data: [10, 50, 10, 15, 70, 22, 33, 55]
          },
          {
            type: 'bar',
            name: '发电量',
            showBackground: false,
            barWidth: 68,
            itemStyle: {
              normal: {
                // color: echarts.graphic.LinearGradient(0, 0, 1, 0, [
                //   {
                //     offset: 0,
                //     color: "rgba(0, 95, 255, 1)",
                //   },
                //   {
                //     offset: 0.5,
                //     color: "rgba(123, 173, 255, 1)",
                //   },
                //   {
                //     offset: 1,
                //     color: "rgba(0, 95, 255, 1)",
                //   },
                // ]),
                // color: barColor,
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : barColor // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                },
                borderColor: barColor,
                borderWidth: 3
              }
            },
            axisLabel: {
              fontSize: 30,
              color: 'white'
            },
            data: [10, 50, 10, 15, 70, 22, 33, 55]
          },
          {
            name: '增速',
            type: 'line',
            yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
            // smooth: true, //平滑曲线显示
            symbolSize: 0, //标记的大小
            color: 'rgba(255, 195, 0, 1)',
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [42, 38, 48, 35, 29, 28, 3, 5]
          }
        ]
      }
      chartsBar.setOption(option, true)
    },
    getChartFour() {
      let chart = echarts.init(this.$refs.pieChart4)
      let barColor = {
        type: 'linear',
        x: 0,
        x2: 1,
        y: 0,
        y2: 0,
        colorStops: [
          { offset: 0, color: 'rgba(41, 223, 255, 0.5)' },
          { offset: 0.5, color: 'rgba(41, 244, 255, 1)' },
          { offset: 1, color: 'rgba(16, 202, 235, 1)' }
        ]
      }
      let option = {
        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        grid: {
          top: 200,
          left: '5%',
          right: '5%',
          bottom: '5%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'category',
            axisLabel: {
              interval: 0,
              align: 'center',
              margin: 10,
              color: '#fff',
              rotate: 0,
              textStyle: {
                fontSize: 40
              }
            },
            splitLine: {
              show: true,
              // interval: information.area.length,
              lineStyle: {
                color: 'rgba(180, 228, 255, 0.1)',
                width: 2
              }
            },
            axisTick: {
              show: false
            },
            boundaryGap: true,
            data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024']
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '万吨标准煤',
            nameGap: 25,
            splitLine: {
              show: false
              // lineStyle: {
              //   color: "#ffffff",
              // },
            },
            nameTextStyle: {
              color: 'white',
              fontSize: 40,
              padding: [0, 0, 10, -60]
            },
            axisLabel: {
              fontSize: 40,
              color: 'white'
            },
            axisLine: {
              lineStyle: {
                // 坐标线
                type: 'solid',
                color: 'rgba(0, 0, 0, 0.5)', // 轴的颜 色
                width: '1' // 坐标线宽度
              }
            }
          },
          {
            name: '增速（%）',
            max: 100,
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, 20]
            },

            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            },
            splitLine: {
              show: false,
              lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)'
              }
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            }
          }
        ],
        series: [
          {
            z: 2,
            name: '能耗总量',
            type: 'pictorialBar',
            symbolPosition: 'end',
            data: [2000, 1900, 2000, 2300, 2500, 2900, 2700, 490, 700, 1400],
            symbol: 'diamond',
            symbolOffset: ['0%', '-50%'],
            symbolSize: [40, 25],
            tooltip: {
              show: false
            },
            itemStyle: {
              borderColor: 'rgba(0, 75, 255, 1)',
              color: {
                type: 'linear',
                x: 0,
                y2: 0,
                colorStops: [
                  { offset: 0, color: 'rgba(161, 247, 255, 1)' },
                  { offset: 1, color: 'rgba(255, 255, 255, 1)' }
                ]
              }
            }
          },
          {
            z: 1,
            type: 'bar',
            name: '能耗总量',
            barWidth: 40,
            barGap: '0',
            data: [2000, 1900, 2000, 2300, 2500, 2900, 2700, 490, 700, 1400],
            itemStyle: {
              borderColor: barColor,
              borderWidth: 3,
              color: function (params) {
                return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : barColor // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
              }
            }
          },
          {
            name: '增速',
            type: 'line',
            symbolSize: 1,
            yAxisIndex: 1,
            color: 'rgba(255, 195, 0, 1)',
            itemStyle: {
              normal: {
                color: 'rgba(255, 195, 0, 1)',
                barBorderRadius: 0,
                label: {
                  show: false
                }
              }
            },
            lineStyle: {
              width: 5
            },
            data: [40, 49, 70, 14, 20, 22, 26, 12, 34, 5]
          }
        ]
      }
      chart.setOption(option, true)
    },
    getChartFive() {
      let chart = echarts.init(this.$refs.pieChart5)
      const payload = {
        id: '',
        data: {
          unit: ['%'],
          x: ['2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
          data1: [3650, 2400, 2800, 1700, 800, 1600, 600, 2600],
          data2: [50, 40, 70, 45, 38, 48, 39, 65]
        }
      }

      // const unit = payload.data.unit || [];
      const x = payload.data.x || []
      const data1 = payload.data.data1 || []

      let option = {
        grid: {
          // 让图表占满容器
          top: '20%',
          left: '3%',
          right: '3%',
          bottom: '10%',
          containLabel: true
        },

        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        xAxis: {
          data: x,
          axisLabel: {
            fontSize: 40,
            color: 'white',
            show: true,
            interval: 0, // 使x轴文字显示全
            formatter: function (params) {
              if (params.length > 6) {
                return `${params.slice(0, 5)}...`
              }
              return params
            },
            margin: 20
          },
          splitLine: {
            show: true,
            // interval: information.area.length,
            lineStyle: {
              color: 'rgba(180, 228, 255, 0.1)',
              width: 2
            }
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: '#fff',
              width: 0,
              type: 'solid'
            }
          }
        },
        yAxis: [
          {
            type: 'value',
            name: '亿吨',
            nameGap: 25,
            splitLine: {
              show: false
              // lineStyle: {
              //   color: "#ffffff",
              // },
            },
            nameTextStyle: {
              color: 'white',
              fontSize: 40,
              padding: [0, 0, 10, -60]
            },
            axisLabel: {
              fontSize: 40,
              color: 'white'
            },
            axisLine: {
              lineStyle: {
                // 坐标线
                type: 'solid',
                color: 'rgba(0, 0, 0, 0.5)', // 轴的颜 色
                width: '1' // 坐标线宽度
              }
            }
          },
          {
            name: '%',
            // max: maxR,
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, 20]
            },

            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            },
            splitLine: {
              show: false,
              lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)'
              }
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            }
          }
        ],
        series: [
          {
            name: '消费量',
            type: 'bar',
            barWidth: 35,
            showBackground: false,
            backgroundStyle: {
              color: 'rgba(21,136,209,0.1)'
            },
            itemStyle: {
              // color: "rgba(41, 215, 227, 1)"
              borderColor: 'rgba(41, 159, 227, 1)',
              borderWidth: 3,
              color: function (params) {
                return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : 'rgba(41, 159, 227, 1)' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
              }
            },
            data: data1,
            z: 0,
            zlevel: 0
          },
          {
            name: '消费量',
            type: 'pictorialBar',
            tooltip: {
              show: false
            },
            barWidth: 35,
            itemStyle: {
              // color: "rgba(1,34,155,1)", //数据的间隔颜色
              color: function (params) {
                return params.name == '2024' ? 'rgba(41, 159, 227, 1)' : '#012c8c' // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
              }
            },
            symbolRepeat: 'true',
            symbolMargin: 6,
            symbol: 'rect',
            symbolSize: [35, 6],
            data: data1,
            z: 1,
            zlevel: 0,
            label: {
              show: false
            }
          },
          {
            z: 9,
            yAxisIndex: 1,
            name: '增速',
            type: 'line',
            // smooth: true, //平滑曲线显示
            showAllSymbol: true, //显示所有图形。
            symbol: 'circle', //标记的图形为实心圆
            color: 'rgba(255, 195, 0, 1)',
            // symbolSize: 26, //标记的大小
            // itemStyle: {
            //     //折线拐点标志的样式
            //     color: "rgba(255, 195, 0, 1)",
            //     borderColor: "#fff",
            //     borderWidth: 6
            // },
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [66, 43, 5, 44, 53, 24, 54, 44]
          }
        ]
      }

      chart.setOption(option, true)
    },
    getChartSix() {
      const chartsBar01 = new echarts.init(this.$refs.pieChart6)
      let barColor = echarts.graphic.LinearGradient(0, 0, 0, 1, [
        {
          offset: 0,
          color: 'rgba(77, 127, 255, 0.6)'
        },
        {
          offset: 1,
          color: 'rgba(46, 105, 255, 0)'
        }
      ])
      var data = [
          { name: '圆柱体1', value: 20 },
          { name: '圆柱体2', value: 13 },
          { name: '圆柱体3', value: 8 }
        ],
        dataList = []
      data.forEach((item, index) => {
        dataList.push(item.value)
      })

      let option = {
        legend: {
          top: '5%',
          icon: 'rect',
          itemWidth: 30,
          itemHeight: 10,
          // selectedMode: false, //不允许点击图例
          itemGap: 50,
          textStyle: {
            fontSize: 40,
            color: '#fff',
            padding: [0, 8]
          }
        },
        xAxis: {
          data: ['2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
          axisLabel: {
            fontSize: 40,
            color: 'white',
            show: true,
            interval: 0, // 使x轴文字显示全
            formatter: function (params) {
              if (params.length > 6) {
                return `${params.slice(0, 5)}...`
              }
              return params
            },
            margin: 20
          },

          splitLine: {
            show: true,
            // interval: information.area.length,
            lineStyle: {
              color: 'rgba(180, 228, 255, 0.1)',
              width: 2
            }
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: '#fff',
              width: 0,
              type: 'solid'
            }
          }
        },
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(8,45,74,0.85)',
          borderColor: 'rgb(140,255,74)', //设置边框颜色
          padding: 12,
          axisPointer: {
            type: 'shadow'
          },
          textStyle: {
            fontSize: 40,
            color: '#fff',
            align: 'left'
          },
          formatter: (params) => {
            let arr = [...params]
            let str = ''
            arr.forEach((item, index) => {
              if (item.componentSubType == 'line') {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '%' +
                  '<br />'
              } else {
                str +=
                  '<span style="margin-right:10px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
                  item.borderColor.colorStops[0].color +
                  ';"></span>' +
                  item.seriesName +
                  '  ' +
                  item.data +
                  '<br />'
              }
            })
            str = arr[0].name + '<br />' + str
            return str
          }
        },

        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: 200,
          padding: '0 0 10 0',
          containLabel: true
        },

        yAxis: [
          {
            type: 'value',
            name: '亿吨',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: true
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          },
          {
            type: 'value',
            name: '%',
            nameTextStyle: {
              color: '#fff',
              fontSize: 40,
              padding: [0, 0, 10, -20]
            },
            position: 'right',
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
                fontSize: 40
              }
            }
          }
        ],
        series: [
          {
            name: '消费量',
            type: 'pictorialBar',
            symbolSize: [68, 20],
            symbolOffset: [0, -5],
            symbolPosition: 'end',
            z: 12,
            tooltip: {
              show: false
            },
            // barWidth: 68,
            label: {
              normal: {
                show: false
              }
            },
            itemStyle: {
              color: 'rgba(0, 132, 255, 1)'
            },
            data: [10, 50, 10, 15, 70, 22, 33, 55]
          },
          {
            type: 'bar',
            name: '消费量',
            showBackground: false,
            backgroundStyle: {
              color: 'rgba(216, 229, 247, 0.55)',
              borderRadius: [6, 6, 0, 0]
            },
            barWidth: 68,
            itemStyle: {
              normal: {
                borderColor: barColor,
                borderWidth: 3,
                // color: barColor,
                color: function (params) {
                  return params.name == '2024' ? 'rgba(20, 157, 220, 0)' : barColor // 如果是最后一个柱子则设置为透明，否则设置为默认颜色
                }
              }
            },
            axisLabel: {
              fontSize: 30,
              color: 'white'
            },
            data: [10, 50, 10, 15, 70, 22, 33, 55]
          },
          {
            name: '增速',
            type: 'line',
            yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
            // smooth: true, //平滑曲线显示
            symbolSize: 0, //标记的大小
            color: 'rgba(255, 195, 0, 1)',
            lineStyle: {
              color: 'rgba(255, 195, 0, 1)',
              width: 5
            },
            data: [42, 38, 48, 35, 29, 28, 3, 5]
          }
        ]
      }
      chartsBar01.setOption(option, true)
    }
  }
})
</script>

<style lang="scss" scoped>
.left-content-box {
  width: 4322px;
  height: 1830px;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  // margin: 0 200px;
  margin: 0 250px 0 200px;

  .pageTitle {
    width: 4322px;
    text-align: center;
    position: absolute;
    color: #fff;
    font-size: 60px;
    margin-top: -186px;
    height: 120px;
    line-height: 120px;
  }

  .contentItem {
    // flex: 1;
    // width: 33.3333%;
    width: 1391px;
    height: calc(50% - 90px);
    // min-width: 33.33333%;
    max-width: 33.33333%;
    padding: 20px;
    box-sizing: border-box;

    .titleBox {
      width: 1391px;
      line-height: 10px;
      text-align: center;

      .title {
        height: 100%;
        font-size: 53px;
        color: #fff;
      }
    }
  }

  // .contentItem:nth-child(2) {

  // }
}
</style>
